import {Component, OnInit, Input, ViewEncapsulation} from '@angular/core';
import {Router} from '@angular/router';

@Component({
  selector: 'video-card-category',
  templateUrl: './card-category.component.html',
  styleUrls: ['./card-category.component.scss'],
  encapsulation: ViewEncapsulation.None
})
export class CardCategoryComponent implements OnInit {
  @Input() category;
  @Input() categoryId;

  constructor(public router: Router) {
  }

  /**
   * 前往视频详情页
   * @param categoryId 分类id
   * @param videoId  视频id
   */
  goToVideoDetailPage(categoryId: number, videoId: number) {
    if (this.categoryId) {
      categoryId = this.categoryId;
    }
    this.router.navigate([`/video/category/${categoryId}`, videoId]);
  }


  ngOnInit() {
  }
}
